import React, { Component } from 'react';
import qs from 'qs';
const DetailData = [
  { id: '01', content: '你好，01' },
  { id: '02', content: '你好，02' },
  { id: '03', content: '你好，03' }
];
export default class Detail extends Component {
  render() {
    console.log(this.props);
    // const { id, title } = this.props.match.params;
    const { search } = this.props.location;

    const { id, title } = qs.parse(search.replace(/^[?]/, ''));

    const content = DetailData.find(detail => detail.id === id)?.content;
    return (
      <ul>
        <li>id:{id}</li>
        <li>title: {title}</li>
        <li>content: {content}</li>
      </ul>
    );
  }
}
